<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>判断奇偶整数</title>
</head>
<body>
    <script>
        var num = -10.2;

        if(num % 1 != 0){
            console.log(num+'这不是整数');
        }else{
            if(num % 2 == 0){
                console.log(num+'是偶数');
            }else{
                console.log(num+'是奇数');
            }
        }
    </script>
</body>
</html>